<style>
<!--
.top_li{
	float:right !important;
	line-height: 2em;
}
#creat_div , #enum_id-label , #is_edit-label , #is_add-label{
	display:none;
}

-->
</style>
<table id="enum_lst">
</table>

<script><!--
$(function() {
	window.grids = $("#enum_lst").flexigrid({
		url: '<?php echo $this->pagePath;?>/enum/index/type/<?php echo $this->enumV;?>',
		dataType: 'json',
		colModel : [
			{display: 'ID', name : 'id', width : 60, sortable : true, align: 'center'},
			{display: '中文名', name : 'name_cn', width : 150, sortable : true, align: 'left'},
			{display: '英文名', name : 'name_en', width : 150, sortable : true, align: 'left'},
			{display: '缩写', name : 'abbreviation', width : 100, sortable : true, align: 'left'}
			
		],
		searchitems : [
            {display: '显示名' ,name : 'name_cn', isdefault: true}
		],
		buttons : [
			<?php if($this->allow('add','enum','')){?>
			{name: '新增',bclass:"add", onpress : add},
			<?php } ?>
			<?php if($this->allow('edit','enum','')){?>
			{name: '编辑',bclass:"edit", onpress : edit},
			<?php } ?>
			<?php if($this->allow('delete','enum','')){?>
			{name: '删除',bclass:"delete", onpress : del},
			<?php } ?>
			/*{name: '编辑权限', onpress : edit_right},*/
			{separator: true}
		], 
		sortname: "id",
		sortorder: "asc",
		//singleSelect:true,//是否单选
		usepager: true,
		hideOnSubmit:false,//禁用遮照
		title: '<?php echo $this->enumT?>列表',
		useRp: true,
		rp: 15,
		showTableToggleBtn: true,
		id:"accountsList",
		width: "99%",
		height: 310,
		onRowClick:function($e){
			bh = $e.find("[abbr='customer_bh'] div").html();
			//element.value = namer;
		},
		onRowDblclick:function(){
			//hideList();
		}
	}).show();
});
var
add = function(name,e){
	var top = $(this).offset().top;
	zendform.zendFormCreat(e,{
		url:"<?php echo $this->pagePath;?>/enum/add/type/<?php echo $this->enumV;?>",
		dialog:{
			title:"新增<?php echo $this->enumT?>",
			width:256,
			height:271,
			position:[null,top]
		}
	});
},
edit = function(name,e){
	id = $(e).find(".trSelected")[0].id.toString().replace("row","") || "0";
	var top = $(this).offset().top;
	zendform.zendFormCreat(e,{
		url:"<?php echo $this->pagePath;?>/enum/edit/type/<?php echo $this->enumV;?>/id/"+(id),
		dialog:{
			title:"修改<?php echo $this->enumT?>",
			width:256,
			height:271,
			position:[null,top]
		}
	});
},
del = function(name,e){
	var ids = $(e).find(".trSelected");
	var idsData = [];
	$.each(ids,function(i,n){
		var uid = n.id.toString().replace("row","") || "0";
		uid = uid;
		idsData.push(uid);
	});
	if(confirm("您确定要删除这"+ids.length+"项数据吗？")){
		$.ajax({
			"url":"<?php echo $this->pagePath;?>/enum/del/type/<?php echo $this->enumV;?>",
			"data":{id:idsData},
			"type":"POST",
			"success":function(data){
				if(data.status > 0){
					var randId = "id_" + Date.parse(new Date());
		        	window.grids.flexReload();
		        	$("<div id='"+randId+"'>"+data.msg+"</div>").dialog({title:"SUCCESS!",height: 140,modal: true});
		        	window.setTimeout(function(){$("#"+randId).dialog("close");},1200);
		        }else{
			        $("<div>ERROR!"+data.msg+"</div>").dialog({title:"ERROR!",height: 140,modal: true});
		        }
			},
			"error":function(){
		    	$("<div>ERROR!<br>服务错误！可能是网络忙！</div>").dialog({title:"ERROR!",height: 140,modal: true});
			}
		});
	}
};
--></script>
<div id="creat_div"></div>
<div id="edit_div"></div>